package com.pink.controller;

import com.pink.entity.dto.VideoFileDto;
import com.pink.entity.dto.VideoInfoDto;
import com.pink.entity.vo.ResponseVo;
import com.pink.service.UserService;
import com.pink.service.VideoFileService;
import com.pink.service.VideoInfoService;
import com.pink.utils.JwtUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/api/video")
@Validated
public class VideoController {

    @Autowired
    VideoInfoService videoInfoService;

    @Resource
    UserService userService;

    @Resource
    JwtUtils utils;
    @Autowired
    private VideoFileService videoFileService;


    /**
     * 获取轮播视频列表
     * @return
     */
    @RequestMapping("/getBannerList")
    public ResponseVo<List<VideoInfoDto>> getBannerList(){
        return ResponseVo.success(videoInfoService.getBannerList());
    }

    /**
     * 获取热门视频列表
     * @return
     */
    @RequestMapping("/getPopularList")
    public ResponseVo<List<VideoInfoDto>> getPopularList(){
        return ResponseVo.success(videoInfoService.getPopularList());
    }

    /**
     * 获取最近更新视频列表
     * @param dateTime
     * @return
     */
    @RequestMapping("/getRecentList")
    public ResponseVo<List<VideoInfoDto>> getRecentList(String dateTime){
        return ResponseVo.success(videoInfoService.getRecentList(dateTime));
    }

    /**
     * 获取指定视频信息
     */
    @RequestMapping("/getVideoInfo")
    public ResponseVo<VideoInfoDto> getVideoInfo(Integer videoId){
        return ResponseVo.success(videoInfoService.getVideoInfo(videoId));
    }

    /**
     * 获取视频集数列表
     */
  @RequestMapping("/getVideoFileList")
    public ResponseVo<List<VideoFileDto>> getVideoFileList(Integer videoId){
        return ResponseVo.success(videoFileService.getVideoFileList(videoId));
    }
}
